package com.kstudio.ksnapshot.klist;

import android.graphics.Bitmap;

public class KListFileData {

    public static final int FOLDER      = 0x0001;
    public static final int FILE        = 0x0002;
    public static final int VIDEO       = 0x0003;
    public static final int PICTURE     = 0x0004;

    private static final char separatorChar = System.getProperty("file.separator", "/").charAt(0);;
    private static final String separator = String.valueOf(separatorChar);

    private Bitmap bitmap;
    private String path;
    private int duration;
    private int attribute;

    public KListFileData(String path, int attribute) {
        this.path = path;
        this.attribute = attribute;
        this.bitmap = null;
        this.duration = 0;
    }

    /* Set function */
    public void setBitmap(Bitmap b) {
        bitmap = b;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    public void setAttribute(int attribute) {
        this.attribute = attribute;
    }

    /* get function */
    public Bitmap getBitmap() {
        return bitmap;
    }

    public String getPath() {
        return path;
    }

    public String getName() {
        int separatorIndex = path.lastIndexOf(separator);
        return (separatorIndex < 0) ? path : path.substring(separatorIndex + 1, path.length());
    }

    public int getDuration() {
        return duration;
    }

    public int getAttribute() {
        return attribute;
    }
}
